/***************************************************************************
Project: 		707769
Date:			15/08/2022
Author: 		Frederik Almar Jensen

Last modified: 06/11/2023
********************************************************************************************************/

/* Defining libraries */
libname raw 'G:\Data\Rawdata\707769\Views'; *Library for raw data;
libname out 'G:\Data\Workdata\707769\FKIX7769\Data'; *Library for output data;

/*******************************************************************************************************/
*HFAUDD AND FINED;
libname fmt '\\srvfsenas1\data\formater\SAS formater i Danmarks statistik\FORMATKATALOG' access=readonly; *formats;
options fmtsearch=(fmt.uddannelser fmt.disced);
****;

data sample;
set out.sample_04_thesis (keep=pnr AAR HFAUDD fined);
if fined in(3 4);
proc sort;
by pnr aar;
run;

*creating educ_field;
data sample2;
set sample;
educ_field = put(hfaudd,$AUDD_FAG_E_L1L4_K.);
educ_field_narrow = put(hfaudd,$AUDD_FIELD_L1L3_K.);
run;

*Export to stata;
proc export data=sample2 outfile="field_of_study.dta" replace; run;s

